package com.netty;

import com.netty.hanler.fram.FrameBaseLine;
import com.netty.source.SourceStart;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.codec.string.StringDecoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Netty 学习源码的启动类
 */
public class NettyStudyDemoMain {
    private static final Logger log = LoggerFactory.getLogger(NettyStudyDemoMain.class);

    public static void main(String[] args) throws InterruptedException {
        final SourceStart start = new SourceStart(
                new StringDecoder(),
                new FrameBaseLine(),
                new ChannelInboundHandlerAdapter() {
                    @Override
                    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
                        log.info("读到数据：{}", msg);
                        super.channelRead(ctx, msg);
                    }
                }
        );
        start.start();
    }
}
